/**
 * 
 */
package com.nannytools.commonObjects;

import java.awt.List;
import java.util.HashMap;
import java.util.Map;

/**
 * @author alex
 *
 */
public class User {
	private String userFirstName = "";
	private String userLastName = "";
	private String userType = "";
	private String userName = "";
	private String userEmail = "";
	private Address userAddress = new Address();
	private String payRateType = "";
	private Double payRateAmount = 0.0;
	private int userId = 0;
	/**
	 * @return the userFirstName
	 */
	public synchronized String getUserFirstName() {
		return userFirstName;
	}
	/**
	 * @return the userId
	 */
	public synchronized int getUserId() {
		return userId;
	}
	/**
	 * @param userId the userId to set
	 */
	public synchronized void setUserId(int userId) {
		this.userId = userId;
	}
	/**
	 * @param userFirstName the userFirstName to set
	 */
	public synchronized void setUserFirstName(String userFirstName) {
		this.userFirstName = userFirstName;
	}
	/**
	 * @return the userLastName
	 */
	public synchronized String getUserLastName() {
		return userLastName;
	}
	/**
	 * @param userLastName the userLastName to set
	 */
	public synchronized void setUserLastName(String userLastName) {
		this.userLastName = userLastName;
	}
	/**
	 * @return the userType
	 */
	public synchronized String getUserType() {
		return userType;
	}
	/**
	 * @param userType the userType to set
	 */
	public synchronized void setUserType(String userType) {
		this.userType = userType;
	}
	/**
	 * @return the userName
	 */
	public synchronized String getUserName() {
		return userName;
	}
	/**
	 * @param userName the userName to set
	 */
	public synchronized void setUserName(String userName) {
		this.userName = userName;
	}
	/**
	 * @return the userEmail
	 */
	public synchronized String getUserEmail() {
		return userEmail;
	}
	/**
	 * @param userEmail the userEmail to set
	 */
	public synchronized void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}
	/**
	 * @return the userAddress
	 */
	public synchronized Address getUserAddress() {
		return userAddress;
	}
	/**
	 * @param userAddress the userAddress to set
	 */
	public synchronized void setUserAddress(Address userAddress) {
		this.userAddress = userAddress;
	}
	/**
	 * @return the payRateType
	 */
	public synchronized String getPayRateType() {
		return payRateType;
	}
	/**
	 * @param payRateType the payRateType to set
	 */
	public synchronized void setPayRateType(String payRateType) {
		this.payRateType = payRateType;
	}
	/**
	 * @return the payRateAmount
	 */
	public synchronized Double getPayRateAmount() {
		return payRateAmount;
	}
	/**
	 * @param payRateAmount the payRateAmount to set
	 */
	public synchronized void setPayRateAmount(Double payRateAmount) {
		this.payRateAmount = payRateAmount;
	}
	//Convert to array
	public String[] convertToArray() {
		Map<String, Object> userMap = new HashMap();
		
		userMap.put("userName", this.userName);
		userMap.put("payRateType", this.payRateType);
		userMap.put("userType", this.userType);
		userMap.put("userFirstName", this.userFirstName);
		userMap.put("userLastName", this.userLastName);
		userMap.put("userRateType", this.payRateType);
		userMap.put("userAddress", this.userAddress.toString());
		userMap.put("userEmail", this.userEmail);
		userMap.put("payRateAmount", this.payRateAmount);
		
		String[] userArray = new String[9];
		
		userArray[0] = Integer.toString(this.userId);
		userArray[1] = this.userName;
		userArray[2] = this.userType;
		userArray[3] = this.userFirstName;
		userArray[4] = this.userLastName;
		userArray[5] = this.userEmail;
		userArray[6] = this.userAddress.toString();
		userArray[7] = this.payRateType;
		userArray[8] = this.payRateAmount.toString();
		
		return userArray;
	}
	
	/** @Comment **/
	public String[] convertToArrayAttributes(){
		String[] userArrayAttr = {"userId", "userFirstName", "userLastName", "userType", "userAddress", "payRateType", "payRateAmount", "userAddress", "userEmail"};
		
		return userArrayAttr;
	}
	
	public String tableName(){
		return "user";
	}
	//Convert object to string
	public String toString() {
		String userStr = "";
		String[] userArray = convertToArray();
		
		for (String userAttr : userArray) {
			userStr = " " + userAttr + " ";
		}
		
		return userStr;
	}
}
